<?php
	/*
	* Nusaview Component for Joomla! 1.5.x
	* Version 1.0
	* Creation date: March 2009
	* Author: Angga Rajasa - Nur Aini Rakhmawati
	* Author email: rajasa.angga@gmail.com
	* License GNU/GPL
	*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

jimport( 'joomla.application.component.view' );
class NvViewPropinsi extends JView{

	function display($tpl = null){
	
		//----------------------  an instance of JApplication
		global $mainframe;
		
		//----------------------   load data from propinsi's model
		$items		= & $this->get( 'Data');
		$pageNav 	= & $this->get( 'Pagination' );
		
		//----------------------   if user request a propinsi's form then load this
		if ($this->getLayout() == 'form') {	

			//----------------------   Setting up Toolbar for Propinsi's form
			$isNew = ($items->id < 1);	
			$text = $isNew ? JText::_( 'New' ) : JText::_( 'Edit' );
			JToolBarHelper::save();
			if ($isNew)  {
				JToolBarHelper::cancel();
			} else {
				JToolBarHelper::cancel( 'cancel', 'Close' );
			}
			
			//----------------------   send to views as an object
			$this->assignRef('items',$items);		
		}
		
		//----------------------   if user request a propinsi's data then load this
		else {
			//----------------------   Assign top menu of nusaview's component
			JSubMenuHelper::addEntry( '<span class="editlinktip hasTip" title="'.JText::_( 'Objek Pariwisata' ).'::'.JText::_('Data-Data Pariwisata').'">'.JText::_( 'Objek Pariwisata' ).'</span>', 'index.php?option=com_nv&controller=objek');
			JSubMenuHelper::addEntry( '<span class="editlinktip hasTip" title="'.JText::_( 'Master Propinsi' ).'::'.JText::_('Master Data Propinsi').'">'.JText::_( 'Master Propinsi' ).'</span>', 'index.php?option=com_nv&controller=propinsi', true);
			JSubMenuHelper::addEntry( '<span class="editlinktip hasTip" title="'.JText::_( 'Master Kota' ).'::'.JText::_('Master Data Kota').'">'.JText::_( 'Master Kota' ).'</span>', 'index.php?option=com_nv&controller=kota');
			//JSubMenuHelper::addEntry( '<span class="editlinktip hasTip" title="'.JText::_( 'Konfigurasi' ).'::'.JText::_('Setting up Form Input').'">'.JText::_( 'Konfigurasi' ).'</span>', 'index.php?option=com_nusaview&controller=konfigurasi');
		/*
			JSubMenuHelper::addEntry( '<span class="editlinktip hasTip" title="'.JText::_( 'Marker' ).'::'.JText::_('Marker GoogleMap').'">'.JText::_( 'Marker' ).'</span>', 'index.php?option=com_nusaview&controller=markers');
		*/				
			
			//----------------------   Setting up Toolbar
			JHTML::_('behavior.tooltip');
			JToolBarHelper::title(   JText::_( 'Master Propinsi Nusantara View' ), 'generic.png' );
			JToolBarHelper::deleteList();
			JToolBarHelper::editListX();
			JToolBarHelper::addNewX();
			
			//----------------------   send to views as an object
			$this->assignRef('items',$items);	
			$this->assignRef('pageNav', $pageNav);			
		}
		//send to html
		parent::display($tpl);
	}// end of function
}// end of class
